#pragma once 
#define CONV(type) (struct sockaddr*)((type))
#define Die(n) exit(n)
#define BACKLOG 8
enum 
{
    SOCKET_ERROR = 1,
    BIND_ERROR,
    LISTEN_ERROR,
};


const int gsocketfd = -1;

//1. r = true && out不为空 2. r = true && out为空 (空行) 3. r = false && out为空 检测到body了
bool ParseOneLine(std::string* out,std::string& package,const std::string& Sep)
{
    auto pos = package.find(Sep);
    if (pos == std::string::npos) return false;
    *out = package.substr(0,pos); //不添加后面的\r\n
    package.erase(0,pos+Sep.size());
    return true;
}

